#include<iostream>
using namespace std;
int next1[200005];
char a[2000005];
char b[2000005];
void buildNext(char *d) {
    next1[0] = -1;
    int k = -1;
    int len = strlen(d);
    for (int j = 0; j < len; j++) {
        // KMP算法，构建next数组
        while (k >= 0 && d[k] != d[j]) {
            k = next1[k];
        }
        k++;
        next1[j + 1] = k;
    }
}
int main(){
    cin>>a;
    cin>>b;
    int ans2=-1;
    int len1=strlen(a);
    int len2=strlen(b);
    buildNext(b);
    int l1=0;
    int l2=0;
    while(l1<len1){
        if(a[l1]==b[l2]){
            l1++;
            l2++;
        }
        else{l2=next1[l2];
               if(l2==-1){l2=0;l1++;}} 
        if(l2==len2){
            ans2=l1-len2;
            break;
        }  
    }
    cout<<next1[len2/4]<<" "<<next1[len2/4*2]<<" "<<next1[len2/4*3]<<endl;
    cout<<ans2;
    return 0;
}